﻿<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Luna" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:avalonedit="http://icsharpcode.net/sharpdevelop/avalonedit"
    xmlns:controls="clr-namespace:SkGui.Controls"
    x:Class="SkGui.MainWindow"
    Title="Babel Stack Decoder" Height="300" Width="300" Background="#FF434343" Loaded="Window_Loaded" Closing="Window_Closing" Icon="BlueBabel.ico">
    <Window.Resources>
        <ContextMenu x:Key="textMenu" Tag="{Binding Tag, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type avalonedit:TextEditor}}}" ContextMenuOpening="textMenu_ContextMenuOpening" >
            <MenuItem x:Name="mnuCut" Header="Cut" Command="ApplicationCommands.Cut" />
            <MenuItem x:Name="mnuCopy" Header="Copy" Command="ApplicationCommands.Copy" />
            <MenuItem x:Name="mnuPaste" Header="Paste" Command="ApplicationCommands.Paste" />
            <Separator/>
            <MenuItem x:Name="mnuSelectAll" Header="SelectAll" Command="ApplicationCommands.SelectAll" />
        </ContextMenu>
    </Window.Resources>
    <Window.Triggers>
		<EventTrigger RoutedEvent="Expander.Expanded" SourceName="expander"/>
		<EventTrigger RoutedEvent="FrameworkElement.Loaded"/>
	</Window.Triggers>
    <Grid x:Name="grid">
		<Grid.RowDefinitions>
			<RowDefinition x:Name="rowText" Height="0.884*"/>
			<RowDefinition x:Name="rowXml" Height="0.116*" />
			<RowDefinition Height="40.698"/>
		</Grid.RowDefinitions>
        <avalonedit:TextEditor x:Name="textStackTrace" Margin="8,36.86,8,1.667" FontSize="13.333" BorderThickness="0" Background="#FF333333" 
                               AllowDrop="True" 
                               ContextMenu="{DynamicResource textMenu}" 
                               PreviewDragOver="textStackTrace_PreviewDragOver" 
                               PreviewDrop="textStackTrace_PreviewDrop"
                               ShowLineNumbers="True"
                               Foreground="White" >
            <avalonedit:TextEditor.Template>
                <ControlTemplate>
                    <ScrollViewer
						Focusable="False"
						x:Name="PART_ScrollViewer"
						CanContentScroll="False"
						VerticalScrollBarVisibility="Auto"
						HorizontalScrollBarVisibility="Auto"
						Content="{Binding TextArea, RelativeSource={RelativeSource TemplatedParent}}"
						VerticalContentAlignment="Top"
						HorizontalContentAlignment="Left"
						Background="{TemplateBinding Background}"
						Padding="{TemplateBinding Padding}"
					/>
                </ControlTemplate>
            </avalonedit:TextEditor.Template>
        </avalonedit:TextEditor>
            <Button x:Name="buttonDeobfuscate"  Margin="7,2.859,7,8" Style="{DynamicResource GlassButton}" Content="Deobfuscate" Grid.Row="2" Click="buttonDeobfuscate_Click"/>
		<GridSplitter x:Name="gridSplitter" HorizontalAlignment="Stretch" Margin="8,-1.98,8,0" Grid.Row="1" Background="#FF434343" VerticalAlignment="Top" Height="4" MouseDoubleClick="gridSplitter_MouseDoubleClick"/>
		<ComboBox x:Name="comboMapFiles" Margin="8,8,36.414,0" VerticalAlignment="Top" FontSize="13.333" Height="22.61" SelectionChanged="comboMapFiles_SelectionChanged" AllowDrop="True" PreviewDrop="comboMapFiles_PreviewDrop" PreviewDragOver="comboMapFiles_PreviewDragOver" />
		<Expander x:Name="expander" Header="XML Map File" Margin="5,2.333,5,1.141" Grid.Row="1" Expanded="expander_Expanded" Collapsed="expander_Collapsed">
			<Grid>
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="0*"/>
					<ColumnDefinition/>
				</Grid.ColumnDefinitions>
                <avalonedit:TextEditor x:Name="textEditor" Foreground="Black" Background="White" FontSize="13.333" ShowLineNumbers="True" Grid.Column="1" ContextMenu="{DynamicResource textMenu}"/>
            </Grid>
		</Expander>
        <TextBlock x:Name="textMessage" Text="Drop stack trace file here or paste data from the clipboard" TextWrapping="Wrap" Margin="8,36.86,8,1.98" Foreground="{DynamicResource NormalBrush}" FontFamily="Verdana" FontSize="24" FontWeight="Bold" TextAlignment="Center" MouseDown="textMessage_MouseDown" AllowDrop="True" PreviewDragOver="textMessage_PreviewDragOver" Padding="18,0,0,0" />
        <Button x:Name="buttonBrowse" HorizontalAlignment="Right" Margin="0,8,8,0" VerticalAlignment="Top" Width="22.848" Height="22.61" Content="..." Style="{DynamicResource GlassButton}" Click="buttonBrowse_Click" ToolTip="Browse for Map File" />
        <controls:ProgressIndicator
            x:Name="progressIndicator"
            HorizontalAlignment="Center"
            VerticalAlignment="Center" Grid.RowSpan="2" />
    </Grid>
</Window>
